/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 26727
 * Date: 2024-04-28
 * Time: 14:48
 */
public class ThreadDemo13 {
    public static void main(String[] args) {
        Object locker = new Object();
        Thread t1 = new Thread(()-> {
            synchronized (locker) {
                System.out.println("wait之前");
                try {
                    locker.wait();
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
                System.out.println("wait之后");
            }
        });
        t1.start();


        Thread t2 = new Thread(()-> {
            System.out.println("notify之前");
            synchronized (locker) {
                locker.notify();
            }
            System.out.println("notify之后");
        });
        t2.start();
    }
}
